﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class CheckMemterController : ApiController
    {
        
         private CheckMemter chm;
        /*
         public CheckMemterController(ILog log, CheckMemterRepository rep, GetNumberRepository getNumber)
        {
            this.log = log;
            this.rep = rep;
            this.getNumber = getNumber;
        }


        private Expression<Func<CheckMemter, bool>> CheckMemterWhere(CheckMemter mr)
        {
            var where = PredicateExtension.True<CheckMemter>();
            return where;
        }

        [POST("GetCheckMemters/{pageIndex}/{pageSize}")]
        public IList<CheckMemter> PostGetCheckMemters(CheckMemter info, int pageIndex, int pageSize)
        {
            var where = CheckMemterWhere(info);
            IList<CheckMemter> list = rep.LoadAll(where, pageIndex, pageSize, new OrderByExpression<CheckMemter, DateTime>(u => u.CreateDt, true));
            return list;
        }

        [POST("GetCheckMemtersCount")]
        public int PostGetCheckMemtersCount(CheckMemter info)
        {
            var where = CheckMemterWhere(info);
            int count = rep.LoadCount(where);
            return count;
        }
        */
        [POST("AddCheckMemter")]
        public bool PostAddCheckMemter(CheckMemter info)
        {
            chm = new CheckMemter();
            bool result = chm.AddCheckMeter(info) > 0 ? true : false;
            return result;
        }
        /*
        [POST("EditCheckMemter")]
        public bool PostEditCheckMemter(CheckMemter info)
        {
            bool result = rep.Edit(info);
            return result;
        }

        [GET("DeleteCheckMemter/{code}")]
        public bool GetDeleteCheckMemter(string code)
        {
            bool result = rep.Delete(code);
            return result;
        }

        [GET("GetCheckMemter/{code}")]
        public CheckMemter GetCheckMemter(string code)
        {
            var result = rep.Get(code);
            return result;
        }
         * */
    }
}
